package com.example.carefree_server.mapper.m_departmentMapper;

import com.example.carefree_server.entity.Pbactivity;
import com.example.carefree_server.entity.Tweet;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ArticleMapper {

    @Insert("insert into tweet(type,did,tname,area,create_time,atime,text,take)" +
            "values(#{type},#{did},#{tname},#{area},now(),#{atime},#{text},#{take})")
    void addArticle(Tweet t);


    @Update("update tweet set type=#{type},tname=#{tname},area=#{area},text=#{text},take=#{take}," +
            "atime=#{atime},update_time=now() where tid=#{tid}")
    void updateArticle(Tweet t);

    @Delete("delete from tweet where tid =#{tid}")
    void deleteArticle(Integer tid);

    @Select("select * from tweet")
    List<Tweet> selectAll();

    @Select("select * from tweet where tid=#{tid}")
    Tweet select(Integer tid);

    @Select("select * from tweet where did = #{did}")
    List<Tweet> selectByDid(String did);
}
